<template>
  <basic-container :btnFlag=true>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>
      <el-form
        label-width="130px"
        :model="projectForm"
        style="padding-right: 30px;"
        :rules="infosrules"
        ref="projectForm"
      >
        <el-row>
          <el-col :span="18" style="margin-top: 27px">
            <el-col :span="10">
              <el-form-item class="form-item" label="分配部门:">
                {{projectForm.supportDeptName}}
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-button size="small" type="primary" icon="el-icon-plus" style="margin-left: 10px;" @click="clickjoint">
                分配部门
              </el-button>
            </el-col>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="22">
            <el-form-item class="form-item" label="材料征集要求 :" prop="financialSource">
              <el-input
                type="textarea"
                :autosize="{ minRows: 4, maxRows: 4}"
                placeholder="请输入材料征集要求"
                v-model="projectForm.financialSource"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="11">
            <el-form-item class="form-item" label="要求反馈时间" prop="releaseDate">
              <el-date-picker
                style="width: 100%"
                v-model="projectForm.releaseDate"
                type="month"
                placeholder="选择年月"
                value-format="yyyy-MM"
                format="yyyy-MM"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="form-submit">
        <el-button type="primary" @click.stop="commitList()">确认</el-button>
        <el-button type="info" @click.stop="goBack()">关闭</el-button>
      </div>
      <xieorg-tree :orgCodeVisiblesubmit="chooseDeptCodeVisiblesubmit" @orgCodeClick="chooseDeptCodeClick"
                   @orgCodeHandleClosesubmit="chooseDeptCodeHandleClosesubmit"
                   @orgCodeCheckChange="chooseDeptCodeCheckChange"></xieorg-tree>
    </div>
  </basic-container>
</template>

<script>
  import {collectionRules} from "@/const/infoRules";

  export default {
    name: "taskAssign",
    data() {
      return {
        headerData: {
          title: '材料收集任务分配'
        },
        infosrules: collectionRules,// 表单验证
        projectForm: {},
      }
    },
    methods: {
      // 弹出选择责任部门弹框
      clickChooseDept() {
        this.chooseDeptCodeVisiblesubmit = true
      },
      chooseDeptCodeClick() {
      },
      chooseDeptCodeHandleClosesubmit() {
        this.chooseDeptCodeVisiblesubmit = false
      },
      chooseDeptCodeCheckChange(data) {
        this.projectForm.supportDeptName = ''
        this.projectForm.deptIds = [];
        for (var i in data) {
          this.projectForm.supportDeptName += data[i].name + ',';
          this.projectForm.deptIds.push(data[i].id);
        }
        this.deptOpinionData = [{label: '责任单位', value: this.projectForm.supportDeptName},];
      },
    }
  }
</script>

<style lang="scss" scoped>
  .card-border {
    border: 1px solid #d2d2d2;
    padding: 12px;
  }

  .form-submit {
    text-align: center;
  }
</style>

